<div class="blogPost">

<% if params[:action] == 'show' %>
<script>
	
	var pageURL = "<%= blog_blog_post_path(@blog) %>";
	 
</script>
<% end%>

	<div class="blogUserImage">
		<%= blog_post.user_image_tag %>
	</div>
	<h1 class="blogPostTitle">
		<%= link_to(h(blog_post.title), [blog_post.blog,blog_post]) %>
		<% if !blog_post.published? %>
			[Draft]
		<% end %>
	</h1>

	<p class="blogPostPostedAt">
		Inserito
		<% if blog_post.show_user? %>
			da <span class="blogPoster"><%= blog_post.user_name %></span>
		<% end %>
		il
		<span class="blogPostDate"><%= blog_post.updated_at.strftime("%d/%m/%Y alle %H:%M") %></span>
	</p>

	<div class="blogPostBody">
		<%= blog_post.parsed_body %>
	</div>

	<hr class="blogPostBreak" />
	<% unless blog_post.tags.blank? %>
		<p class="blogPostTags">
			<b>Tags: </b>
			<%= blog_post.tags_with_links %>
		</p>
	<% end %>
	
	<p class="blogFooter">
		<ul class="blogList">
			<% if params[:action] == 'show' %>
			<li class="blogListFirst"><%= link_to(pluralize(blog_post.blog_comments.count, 'comment'), blog_blog_post_path(@blog,blog_post), :class => 'blogCommentCount') %></li>
				<% if params[:controller] != 'blogs' %>
					<li><%= link_to('Torna al blog', blog_path(@blog)) %></li>
				<% end %>
			<% end %>
		
		
			<% if current_user && current_user.admin? %>
				<li><%= link_to('Modifica', edit_blog_blog_post_path(@blog,blog_post)) if (logged_in? and current_user.is_my_blog_post? blog_post.id)%></li>
				<li><%= link_to('Cancella', blog_blog_post_path(@blog,blog_post), :method => :delete, :confirm => "Sei sicuro di voler cancellare il post: #{blog_post.title}") if (logged_in? and current_user.is_my_blog_post? blog_post.id) %></li>
			<% end %>
		</ul>
	</p>
	
	<% if defined?(show_comments) %>
		<%= render :partial => 'blog_comments/new_blog_comment', :locals => {:blog_comment => @blog_comment} %>
		
		<div id="blogPostCommentsContainer">
		<%= render :partial => 'blog_posts/comments' %>
	  </div>
	<% end %>
	
	<br style="clear: both;" />
</div>